home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Sample Code / AppsToGo / Kibitz / EventLoop.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-24  |  1.8 KB  |  76 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** MultiFinder-Aware Kibitz Application
  5. **
  6. ** File:             eventloop.c
  7. ** Originally from:  Traffic Light 2.0 (2.0 version by Keith Rollin)
  8. ** Modified by:      Eric Soldan
  9. **
  10. ** Copyright © 1990-1992 Apple Computer, Inc.
  11. ** All rights reserved. */
  12.  
  13.  
  14.  
  15. /*****************************************************************************/
  16.  
  17.  
  18.  
  19. #include "Kibitz.h"                /* Get the Kibitz includes/typedefs, etc.    */
  20. #include "KibitzCommon.h"        /* Get the stuff in common with rez.        */
  21. #include "Kibitz.protos"        /* Get the prototypes for Kibitz.            */
  22.  
  23. #ifndef __TEXTEDITCONTROL__
  24. #include <TextEditControl.h>
  25. #endif
  26.  
  27.  
  28.  
  29. /*****************************************************************************/
  30.  
  31.  
  32.  
  33. extern RgnHandle    gCurrentCursorRgn;        /* The current cursor region.
  34.                                             ** The initial cursor region is
  35.                                             ** an empty region, which will
  36.                                             ** cause WaitNextEvent to generate
  37.                                             ** a mouse-moved event, which will
  38.                                             ** cause us to set the cursor for
  39.                                             ** the first time.
  40.                                             */
  41. extern Boolean        gQuitApplication;        /* This is set to false by
  42.                                             ** Initialize.  When the user
  43.                                             ** selects Quit (and does not
  44.                                             ** abort the quit), then this
  45.                                             ** boolean is set true.
  46.                                             */
  47.  
  48.  
  49.  
  50. /*****************************************************************************/
  51. /*****************************************************************************/
  52.  
  53.  
  54.  
  55. /* Get events forever, and handle them by calling DoEvent.  Get the events by
  56. ** calling WaitNextEvent.  (This sample does a DeathAlert if WaitNextEvent
  57. ** isn't available.) */
  58.  
  59. #pragma segment Main
  60. void    EventLoop(void)
  61. {
  62.     EventRecord        event;
  63.  
  64.     while (!gQuitApplication) {
  65.  
  66.         if (!WaitNextEvent(everyEvent, &event, 15, gCurrentCursorRgn))
  67.             event.what = nullEvent;
  68.         DoEvent(&event);
  69.  
  70.         CTEIdle();
  71.     };
  72. }
  73.  
  74.  
  75.  
  76.